home *** CD-ROM | disk | FTP | other *** search
/ Champak 26 (Anniversary Edition) / Volume 26 [Anniversary Edition] - JOGO DISK .iso / Fight / bandit_kings.swf / scripts / DefineSprite_66 / frame_1 / DoAction.as
Text File  |  2006-07-26  |  800b  |  36 lines

  1. if(_parent._x < -300)
  2. {
  3.    if(_root.finished != true)
  4.    {
  5.       _parent._x = 600;
  6.    }
  7. }
  8. else
  9. {
  10.    _parent._x -= _root.speed_caravan;
  11. }
  12. i = 1;
  13. while(i < 3)
  14. {
  15.    if((_root["p" + i]._x - 90 < _parent._x && _parent._x < _root["p" + i]._x + 60 && _root["p" + i]._xscale < 0 || _parent._x < _root["p" + i]._x + 90 && _root["p" + i]._x - 60 < _parent._x && 0 < _root["p" + i]._xscale) && _root["p" + i].attacking == true)
  16.    {
  17.       _root["p" + i].attacking = false;
  18.       _parent.hp--;
  19.       _root.s_hit2.start();
  20.       _parent.caravan.play();
  21.    }
  22.    i++;
  23. }
  24. if(_parent.hp == 0)
  25. {
  26.    _parent.hp = 20;
  27.    if(random(4) == 1)
  28.    {
  29.       _root.drop_loot("chest",_parent._x,_parent._y - 10);
  30.    }
  31.    else
  32.    {
  33.       _root.drop_loot("bag",_parent._x,_parent._y - 10);
  34.    }
  35. }
  36.